"""
@version:python3
@author:ll
@file:03-QObject-父子关系对控件的影响.py
@time:2022/2/7 22:45
"""
from PyQt5.Qt import *


class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("")
        self.resize(500, 500)
        self.setup_ui()

    def setup_ui(self):  # 添加子控件以及子控件的配置操作
        pass


if __name__ == "__main__":
    import sys

    app = QApplication(sys.argv)
    # win1 = QWidget()
    # win1.setStyleSheet("background-color:red;")
    # win1.resize(500,500)
    # win1.show()
    #
    # win2 = QWidget()
    # win2.setStyleSheet("background-color:green;")
    # win2.setParent(win1)
    # win2.resize(1000,100)
    # win2.show()

    win_root = QWidget()
    label1 = QLabel()
    label1.setText("label1")
    label1.setParent(win_root)

    label2 = QLabel()
    label2.setText("label2")
    label2.setParent(win_root)
    label2.move(50,50)

    btn = QPushButton(win_root)
    btn.setText("btn")
    btn.move(100,100)

    win_root.show()

    for sub in win_root.findChildren(QLabel):
        print(sub)
        sub.setStyleSheet("background-color:cyan;")



    sys.exit(app.exec_())
